// A-S-M team
// Project: BattleCity
// Created: 26.03.2011
// Last change: 26.03.2011
// Description: class-singleton "Keyboard" manages information about the state
//	of all keys on the keyboard

#pragma once
#include <ClanLib/display.h>

using namespace std;

class Keyboard
{

// sigleton pattern implementation
public:
	static Keyboard * getInstance()
	{
		if (!p_instance)
			p_instance = new Keyboard();
		return p_instance;
	}
private:
	Keyboard() {}
    Keyboard(const Keyboard&);  
    Keyboard& operator=(Keyboard&);
	static Keyboard * p_instance;

public:
	void init(CL_InputDevice &keyboard) { _keyboard = keyboard; }	// must be called before first use
	bool getKeyCode(int key) { return _keyboard.get_keycode(key); }

private:
	CL_InputDevice _keyboard;
};
